{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Forecasting competition"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To help make it easier for you to participate in our motion forecasting challenge, we provide an example notebook for the task"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## A simple baseline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's say we have our (very very naive) prediction function;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [],
   "source": [
    "def prediction(trajectory,num_points=30,avg_points=1):\n",
    "    #a simple prediction function that predict straight line with constant velocity\n",
    "    velocity_x_mps = []\n",
    "    velocity_y_mps = []\n",
    "    for i in range(1,avg_points+1,1):\n",
    "        velocity_x_mps.append(trajectory[-i,0] - trajectory[-(1+i),0])\n",
    "        velocity_y_mps.append(trajectory[-i,1] - trajectory[-(1+i),1])\n",
    "        \n",
    "    velocity_x_mps = np.mean(velocity_x_mps)\n",
    "    velocity_y_mps = np.mean(velocity_y_mps)\n",
    "    \n",
    "    current_traj = trajectory[-1]\n",
    "    results = np.zeros((len(trajectory)+num_points,2))\n",
    "    \n",
    "    results[0:len(trajectory)] = trajectory\n",
    "    \n",
    "    for i in range(num_points):\n",
    "        results[len(trajectory)+i] = np.array([current_traj[0]+velocity_x_mps,current_traj[1]+velocity_y_mps])\n",
    "        current_traj = results[len(trajectory)+i]\n",
    "    return results"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's try that on our argoverse forecasting test set"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total number of sequences: 78143\n"
     ]
    }
   ],
   "source": [
    "from argoverse.data_loading.argoverse_forecasting_loader import ArgoverseForecastingLoader\n",
    "\n",
    "##set root_dir to the correct path to your dataset folder\n",
    "root_dir = '/Users/psangkloy/Downloads/data/test_obs/data/'\n",
    "\n",
    "afl = ArgoverseForecastingLoader(root_dir)\n",
    "\n",
    "print('Total number of sequences:',len(afl))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [],
   "source": [
    "afl = afl[111]\n",
    "predict_traj = prediction(afl.agent_traj,avg_points=5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here is an example of our prediction, initial trajectory in blue and the predicted trajectory in red"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAACMCAYAAACeRcVzAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAGoVJREFUeJzt3XmUVPWd9/H3lx2UpdlUlqbBCMgSUFth4oZAXOMYJZOohCBqzBk1ISbjTObRhKhxJnGSmeh5npj4PIlbMCouURIXUFmixoMgW4Mia2MQVwQiYMvyff743bKq91tQ1beq+/M6556u+tWt278f1c2372/7mrsjIiItW6ukKyAiIslTMBAREQUDERFRMBARERQMREQEBQMREUHBQEREUDAQEREUDEREBAUDEREB2iRdgbh69uzpZWVlSVdDRKSoLFmy5AN379XYeUUTDMrKyli8eHHS1RARKSpmVhnnvObfTbR1K+zdm3QtREQKWqw7AzMrB04F+gB7gApgrrt/lMe65caXvwxLl8LgwTBiRPVj4EBo3TrpGoqIJK7BYGBm04BvAxuBJcAaoANwCvBvZlYB/NDdN+e7ogft+uthyRKoqIBFi+Chh9KvdewIw4bB8OHVg0S/fmCWXJ1FRJp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Y2ZvmtlMM5toZi9FSVBOis47ycz+amZLzexlMxsSlV9mZk+Y2fzo/BkNfK8TowQqHaKtDlZlJlKp4/x/ixKrLDezn0Zlo6NdU1dYSMhS0kj5fDP7pYXELNOj7QX+Gl33Jw3800wmvV3DuOgu4Qkz22BmPzWzyRYSwaw0s6MB3H03sCn1byZSp6SXaOvQUdcBlBHyFYwk/NGyBPgdYIT92/8YndeF8JcywETg0ejxZYSl/z2AjoQtLMob+H4/AX4O/B/g3xs47xzgZaBT9Dy1dcIK4PTo8c3ALxspnw/8KuO6TwLfiB5fQx0JewjJTN7JeD4O2A4cRUiCsgW4KXpteup7Rc9vAL6f9Oeqo3AP3RlIIdvo7is95C1YRch05YQ9iMqic7oCsyykEvwfYHjG++e6+4fuvoewt80pDXyvm4EvAuWEzFv1mQjc7eGvbdx9W7RxYjd3XxCdcy9wWn3lGdd6KOPxyaR34b2/nu/dk/Cff6ZX3X2ru1cR9qqZE5Vn/htB2Am0TwPtkhZOwUAKWVXG4wMZzw+QzsVxCzDP3UcQclx0yHhPzQGxhgbIehAyqHWucY182lXjeWMDeHuoXbc4/0ZE79uTbQWl5VAwkGLXlfR+7pfVeO2LFpKtdySkUnypgev8BvghMBP4WQPnzQWmRYOymFl3d98BfGRmp0bnTAEW1Fdez3VfImxHDGFcoBYPKU1bm9nBBKvBNL9tniWHFAyk2N0G/KeZLaV25r5FhLSoKwhjCYvruoCZfQPY6+4PELJrnWhm4+s6192fIfTvL44ycP1L9NJU4L/MbAUwmtDt1FB5TdOBa8xsJQ2nMZxDw91d9TmZEMhE6qSppdIsmdllhAHja5OuSy6Z2fHAde4+JYv3HAd8L5v3SMujOwORIuLurwHzsll0Rhh4/mGeqiTNhO4MpMUws1RGrZomuPuHNc4dSe1ZPVXuPiZf9RNJkoKBiIiom0hERBQMREQEBQMREUHBQEREUDAQERHg/wNiPV+i1KCX6wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "ax = plt.gca()\n",
    "plt.plot(predict_traj[0,0],predict_traj[0,1],'-o',c='r') #starting point here\n",
    "plt.plot(predict_traj[:21,0],predict_traj[:21,1],'-',c='b')\n",
    "plt.plot(predict_traj[20:,0],predict_traj[20:,1],'-',c='r')\n",
    "\n",
    "plt.xlabel('map_x_coord (m)')\n",
    "plt.ylabel('map_y_coord (m)')\n",
    "ax.set_aspect('equal')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Due to the multimodal nature of the problem, our challenge allows for (expects) multiple forecasts for each object.\n",
    "\n",
    "For the purposes of this tutorial we will use different averaging windows to create multiple entries per object."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_multiple_forecasts(afl):\n",
    "    predict_traj = []\n",
    "    for i in range(9,3,-1):\n",
    "        predict_traj.append(prediction(afl.agent_traj,avg_points=(i)))\n",
    "    return np.array(predict_traj)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [],
   "source": [
    "predict_traj = get_multiple_forecasts(afl)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAACZCAYAAADNXlZbAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xl4nGd56P/vPZtmRou12pbteInj2PEiWbLseAlJSNjKD1og5TQ9KZBAm16sAdpzytKW0hYKHM4Fpe3hlF9Z0pIDFBIg6a8tyclqO4kTO/G+L/HuSLIWS5p95v798bySxkayZHvkkeT7c11zaead9515Ho2kW892P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fm/WMjDj2RFV3aFuL4JduJ2tFJdXaK53zhTgp+K2EvwGsCTv+idU9ayqxnG5bG65yHv9JfBmoAW309Zw3gR8X91/26hqh5fwsFJVn/XOeRC4dbjjea/1k7z76xjMnvsvw7x3Le6Pf76XVfW0qiZxuWoe947nf4/AZf6ccZF6mWucBQMzniXz7ufyHucY3Ivjr4CnVXUpbm+KcN41Fw6IXWyArAa3K1r5Ba8xlvoueDzSAF6cXy/baL5HeNfFL7WA5tphwcBMdFMYzOd+7wXPvVnc5uoR3NaJGy/yOv8I/BnwEPDVi5z3BHCfNyiLiFSrajfQKSJv8M55H/DscMeHed2NuHTE4MYFfo26bUn9InI5wepGJn5aZzOGLBiYie5rwN+IyKv8+s59L+G2M92OG0vYPNQLiMj7gbSq/h/cblorReSOoc5V1f/E9e9v9nbc+mPvqQ8A/0NEtgPLcd1OFzt+oQeAj4rIDi6+jeHjXLy7azjrcIHMmCHZ1FIzKYnIvbgB448VuyyFJCLNwKdU9X2XcE0T8OlLucZce6xlYMwEoqqvAE9fyqIz3MDzn41RkcwkYS0Dc80Qkf4dtC50p6qeveDcZfz6rJ6kqt48VuUzppgsGBhjjLFuImOMMRYMjDHGYMHAGGMMFgyMMcYA/z8X63YSlmXVqwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "ax = plt.gca()\n",
    "\n",
    "plt.plot(predict_traj[0,0,0],predict_traj[0,0,1],'-o',c='r') #starting point here\n",
    "plt.plot(predict_traj[0,:21,0],predict_traj[0,:21,1],'-',c='b')\n",
    "\n",
    "for i in range(len(predict_traj)):\n",
    "    plt.plot(predict_traj[i,20:,0],predict_traj[i,20:,1],'-',c=np.random.rand(3,))\n",
    "plt.xlabel('map_x_coord (m)')\n",
    "plt.ylabel('map_y_coord (m)')\n",
    "ax.set_aspect('equal')\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Compute all the results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "78143/78143"
     ]
    }
   ],
   "source": [
    "output_all = {}\n",
    "counter = 1\n",
    "for data in afl:\n",
    "    print('\\r'+str(counter)+'/'+str(len(afl)),end=\"\")\n",
    "    predict_traj = get_multiple_forecasts(data)\n",
    "    seq_id = int(data.current_seq.name[:-4])\n",
    "    output_all[seq_id] = predict_traj[:,20:,:]\n",
    "    counter += 1\n",
    "    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Generate the result file"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To participate in our competition, you need to upload the result file to our evaluation server on EvalAI https://evalai.cloudcv.org/. Make sure that your results are in the right format, and then call our helper function `generate_forecasting_h5`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "25747/78143"
     ]
    }
   ],
   "source": [
    "from argoverse.evaluation.competition_util import generate_forecasting_h5\n",
    "\n",
    "output_path = 'competition_files/'\n",
    "\n",
    "generate_forecasting_h5(output_all, output_path) #this might take awhile"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You are all set!! \n",
    "\n",
    "Simply upload the output file `competition_files/argoverse_forecasting_baseline.h5` to our evaluation server on https://evalai.cloudcv.org/ and see how well you did it"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
